GBML manual / Link Cable

link_players

How many consoles are playing, counting this one: 0 while the link is off, 1 when it is on and nobody else has been heard, up to 4 with a four-way cable.

Works differently on Game Boy - The Game Boy link cable joins two consoles, not four: players 3 and 4 are never there and read as not pressing anything, and the two consoles decide between themselves which one is player 1, so it can be a different one each time they meet.

Works differently on Game Boy Color - The Game Boy Color link cable joins two consoles, not four: players 3 and 4 are never there and read as not pressing anything, and the two consoles decide between themselves which one is player 1, so it can be a different one each time they meet.

On other consoles this differs: see Side by side and How the consoles differ.

Syntax

link_players() -> int

Returns

int

Description

How many consoles are playing, counting this one. It is 0 while the link is off, 1 when it is on and nobody else has been heard, and up to 4 with a four-way cable.

Player numbers are the cable's own, so with three players the numbers in use could be 1, 2 and 4. Use this to count, and ask about a player by number whenever you like: a player who is not there reads as nothing pressed, never as an error.

Example

var count = link_players();
draw_text(12, 8, $"PLAYERS: {count}");

Shows how many consoles are playing.

On the GBA

The numbers are the cable’s own, so with three players the numbers in use could be 1, 2 and 4: count with this, and ask about a player by number only when that player is there (a player who is not there reads as nothing pressed, never an error).

See also: link_connectedlink_playerThe link cable